package com.minivision.sdktestdemo.bean;

import android.database.Cursor;
import android.net.Uri;
import android.provider.MediaStore;

/**
 * Created by devtang on 2016/4/8.
 */
public class MusicBean implements UriOrderGetter {
    //歌曲名称
    private String mMusicName;
    //歌手名称
    private String mSingerName;
    //专辑名称
    private String mAlbumName;
    //歌曲大小
    private int mSize;
    //歌曲时长
    private int mLen;
    //歌曲的文件路径
    private String mPath;
    //专辑的图片URI
    private Uri mPicUri;
    //歌曲在数据库的唯一标识
    private int mId;

    public Uri getmPicUri() {
        return mPicUri;
    }

    public void setmPicUri(Uri mPicUri) {
        this.mPicUri = mPicUri;
    }

    //专辑的ID
    private int mAlbumId;

    public int getmId() {
        return mId;
    }

    public MusicBean(String mMusicName, String mSingerName, String mAlbumName, int mSize, int mLen, Uri mUri, String mPath, int albumId) {
        this.mMusicName = mMusicName;
        this.mSingerName = mSingerName;
        this.mAlbumName = mAlbumName;
        this.mSize = mSize;
        this.mLen = mLen;
        this.mPath = mPath;
        this.mAlbumId = albumId;
    }

    public int getmAlbumId() {
        return mAlbumId;
    }

    public void setmAlbumId(int mAlbumId) {
        this.mAlbumId = mAlbumId;
    }

    public MusicBean(Cursor cursor) {
        if (cursor != null) {
            mSingerName = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST));
            mAlbumName = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ALBUM));
            mLen = cursor.getInt(cursor.getColumnIndex(MediaStore.Audio.Media.DURATION));
            mSize = cursor.getInt(cursor.getColumnIndex(MediaStore.Audio.Media.SIZE));
            mMusicName = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.TITLE));
            mPath = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DATA));
            mAlbumId = cursor.getInt(cursor.getColumnIndex(MediaStore.Audio.Media.ALBUM_ID));
            mId = cursor.getInt(cursor.getColumnIndex(MediaStore.Audio.Media._ID));
        }
    }

    public String getmPath() {
        return mPath;
    }

    public void setmPath(String mPath) {
        this.mPath = mPath;
    }

    public String getmMusicName() {
        return mMusicName;
    }

    public void setmMusicName(String mMusicName) {
        this.mMusicName = mMusicName;
    }

    public String getmSingerName() {
        return mSingerName;
    }

    public void setmSingerName(String mSingerName) {
        this.mSingerName = mSingerName;
    }

    public String getmAlbumName() {
        return mAlbumName;
    }

    public void setmAlbumName(String mAlbumName) {
        this.mAlbumName = mAlbumName;
    }

    public int getmSize() {
        return mSize;
    }

    public void setmSize(int mSize) {
        this.mSize = mSize;
    }

    public int getmLen() {
        return mLen;
    }

    public void setmLen(int mLen) {
        this.mLen = mLen;
    }

    @Override
    public String getKey() {
        return getmMusicName();
    }

    @Override
    public String getId() {
        return mPath;
    }
}
